<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('新增dubbo接口')" />
	<link th:href="@{/css/common.css}" rel="stylesheet"/>
	<link th:href="@{/css/detail.css}" rel="stylesheet"/>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content">
	<div class="content">
		<input th:field="*{interfaceInfo.id}" id="id" type="hidden">
		<input th:field="*{interfaceInfo.fbType}" type="hidden">
		<div class="content-box">
			<div class="info-head">
				<p class="pull-left">
					<span class="label label-flag" th:text="${interfaceInfo.interfaceType=='1'?'GET': (interfaceInfo.interfaceType=='2' ? 'POST' : (interfaceInfo.interfaceType=='3' ? 'PUT' : 'DELETE'))}"></span>
					<span th:text="${interfaceInfo.interfaceName}">接口名称</span>
					<span th:text="${interfaceInfo.interfaceUrl}">/v1/createVersion</span>
				</p>
				<p class="pull-right" th:if="${interfaceInfo.fbType} == '2'">
					<span th:if="${interfaceUser} != null">
<!--						<img class="head-img" th:src="@{/img/login-background.jpg}"/>-->
						<span th:text="${interfaceUser.username}"></span>(<span th:text="${interfaceUser.roleName}"></span>)
					</span>
					<span th:if="${owner} != null">
						<select name="status" id="status" th:with="type=${@dict.getType('status')}">
                        	<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="${interfaceUser.objectStatus}"></option>
                    	</select>
					</span>
				</p>
			</div>
			<div class="tips" th:text="${interfaceInfo.interfaceDescription}"></div>
			<div class="table-info">
				<ul class="list-group">
					<li class="list-group-item">
						<span>读写类型</span>
						<span th:text="${interfaceInfo.optType=='1'?'增': (interfaceInfo.optType=='2' ? '删' : (interfaceInfo.optType=='3' ? '改' : '查'))}"></span>
					</li>
					<li class="list-group-item">
						<span>前后类型</span>
						<span th:text="${interfaceInfo.fbType=='1'?'METHOD': (interfaceInfo.fbType=='2' ? 'BFF' : 'DUBBO')}">BFF</span>
					</li>
					<li class="list-group-item">
						<span>是否分页</span>
						<span th:text="${interfaceInfo.isPage=='Y'?'是':'否'}">写入</span>
					</li>
					<li class="list-group-item">
						<span>内容条数</span>
						<span th:text="${interfaceInfo.isPage=='Y'?'1000':''}">1000</span>
					</li>
					<li class="list-group-item">
						<span>页数</span>
						<span th:text="${interfaceInfo.page}">一</span>
					</li>
					<li class="list-group-item">
						<span>分页内容数</span>
						<span th:text="${interfaceInfo.pageSize}">一</span>
					</li>
					<li class="list-group-item">
						<span>创建人</span>
						<span th:text="${interfaceInfo.createBy}">王树立</span>
					</li>
					<li class="list-group-item">
						<span>创建时间</span>
						<span th:text="${#dates.format(interfaceInfo.createTime, 'yyyy-MM-dd HH:mm:ss')}">2021.11.21 13:21</span>
					</li>
					<li class="list-group-item"></li>
					<li class="list-group-item">
						<span>更新人</span>
						<span th:text="${interfaceInfo.updateBy}">王树立</span>
					</li>
					<li class="list-group-item">
						<span>更新时间</span>
						<span th:text="${#dates.format(interfaceInfo.updateTime, 'yyyy-MM-dd HH:mm:ss')}">2021.11.21 13:21</span>
					</li>
				</ul>
			</div>
			<ul class="nav nav-tabs navtabs contentTab" role="tablist">
				<li class="active"><a href="#content-preview" role="tab" data-action = "doPreview" data-toggle="tab">接口预览</a></li>
				<li><a href="#content-field" role="tab" data-toggle="tab" data-action = "relationFieldList">关联字段</a></li>
				<li><a href="#content-table" role="tab" data-toggle="tab" data-action = "relationTableList">关联表</a></li>
				<li th:if="${interfaceInfo.fbType} == 2"><a href="#content-page" role="tab" data-toggle="tab" data-action = "relationPageList">关联页面</a></li>
				<li th:if="${interfaceInfo.fbType} == 2"><a href="#content-usage" role="tab" data-toggle="tab" data-action = "relationUsageList">关联用况</a></li>
				<li><a href="#content-service" role="tab" data-toggle="tab" data-action = "relationBusinessSystemList">关联业务系统</a></li>
				<li th:if="${interfaceInfo.fbType} == 2"><a href="#content-question" role="tab" data-toggle="tab" data-action = "relationQuestionList">问题备注</a></li>
				<li><a href="#content-nodemand" role="tab" data-toggle="tab">非功能性需求</a></li>
			</ul>
			<div class="tab-content">
				<div role="tabpanel" class="tab-pane active mt20 " id="content-preview">
					<div class="ibox-content content-preview">
						<div class="panel-body">
							<div class="panel-group" id="accordion">
								<div class="panel panel-default">
									<div th:if="${interfaceInfo.fbType } != 1" class="panel-heading" data-toggle="collapse" href="#collapse0" style = "margin-bottom: 10px;">
										<h1 class="panel-title">
											<span class="pl20">参数</span>
										</h1>
									</div>
									<div id="collapse0" class="panel-collapse collapse in">
									</div>
								</div>
								<div class="panel-tit" th:if="${interfaceInfo.fbType} != 1" id="virtualUsage">虚拟用况</div>
							</div>
						</div>
					</div>
				</div>
				<div role="tabpanel" class="tab-pane mt20 content-field" id="content-field"></div>
				<div role="tabpanel" class="tab-pane content-table mt20" id="content-table"></div>
				<div role="tabpanel" class="tab-pane mt20 content-page" id="content-page"></div>
				<div role="tabpanel" class="tab-pane content-usage mt20" id="content-usage"></div>
				<div role="tabpanel" class="tab-pane mt20 content-service" id="content-service"></div>
				<div role="tabpanel" class="tab-pane mt20 content-question" id="content-question"></div>
				<div role="tabpanel" class="tab-pane content-nodemand" id="content-nodemand">
					<div th:text="${interfaceInfo.nonFunctionalRequirements}">-</div>
				</div>
			</div>
		</div>
	</div>
</div>
</div>
</div>
</body>
<th:block th:include="include :: footer"/>

<!--关联字段模板-->
<script id="contentPreviewTpl" type="text/template">
	<div class="panel-body" style = "border:0px;">
		<ul class="list-group">
			<li class="list-group-item" style="height: auto; padding-top:0px;">
				<div class="re-body">
					<p>requestBody：//输入参数</p>
					<p>{</p>
					<ul class="list-group field">
						{{# layui.each(d.requestList, function(index, a){ }}
						{{# if(a.children == null || a.children.length == 0){ }}
						<li class="list-group-item">
							{{# if(a.objectType=='2'){ }}
							<p>"{{a.fieldEnName}}" : [{ // {{a.fieldName || '-'}}</p>
							<br>
							<p>}],</p>
							{{# } else { }}
							<p>"{{a.fieldEnName}}" : "{{a.mockData || '一'}}", // <span style="color: #FFA500; display: inline !important;">{{a.fieldName || '-'}}{{a.fieldEnumListName || ''}}</span></p>
							{{# } }}
						</li>
						{{# } else { }}
						<li class="list-group-item">
							{{# if(a.children.length > 1){ }}
								<p>"{{a.fieldEnName}}" : [{ // {{a.fieldName || '一'}}</p>
								<ul class="list-group field">
									{{# layui.each(a.children, function(index, b){ }}
									<li class="list-group-item" style = "margin-left:10px;">
										<p>"{{b.fieldEnName}}" : "{{b.mockData || '一'}}", // <span style="color: #FFA500; display: inline !important;">{{b.fieldName || '一'}}{{b.fieldEnumListName || ''}}</span></p>
									</li>
									{{# }); }}
								</ul>
								<p>}],</p>
							{{# } else { }}
								<p>"{{a.fieldEnName}}" : ["{{a.children[0].mockData || '一'}}"], // {{a.fieldName || '一'}}</p>
							{{# } }}
						</li>
						{{# }}}
						{{# }); }}
					</ul>
					<p>}</p>
				</div>
			</li>
			<li class="list-group-item space"></li>
			<li class="list-group-item" style="height: auto;padding-top:0px;">
				<div class="re-body">
					<p>response：//返回参数</p>
					<p>{</p>
					<ul class="list-group field">
						<li class="list-group-item">
							<p>"errCode" : "1",<span style="color: red; display: inline !important;"> //返回状态（true/false）</span></p>
							<p>"message" : "获取成功",<span style="color: red; display: inline !important;"> //获取成功/获取失败</span></p>
							<p>"data" : { <span style="color: red; display: inline !important;"> //返回数据</span></p>
							<ul class="list-group field">
								{{# layui.each(d.responseList, function(index, a){ }}
								{{# if(a.children == null || a.children.length == 0){ }}
								<li class="list-group-item">
									{{# if(a.objectType=='2'){ }}
									<p>"{{a.fieldEnName}}" : [{ // {{a.fieldName || '一'}}</p>
									<p>}],</p>
									{{# } else { }}
									{{# if(a.fieldEnName == 'total' || a.fieldEnName == 'isLastPage' || a.fieldEnName == 'pages'){ }}
									<p>"{{a.fieldEnName}}" : {{a.mockData}}, // <span style="color: #FFA500; display: inline !important;">{{a.fieldName || '一'}}{{a.fieldEnumListName || ''}}</span></p>
									{{# } else { }}
									<p>"{{a.fieldEnName}}" : "{{a.mockData || '一'}}", // <span style="color: #FFA500; display: inline !important;">{{a.fieldName || '一'}}{{a.fieldEnumListName || ''}}</span></p>
									{{# } }}
									{{# } }}
								</li>
								{{# } else { }}
								<li class="list-group-item">
									<p>"{{a.fieldEnName}}" : [{ // {{a.fieldName || '一'}}</p>
									<ul class="list-group field">
										{{# layui.each(a.children, function(index, b){ }}
										{{# if(b.children == null || b.children.length == 0){ }}
										<li class="list-group-item">
											{{# if(b.objectType=='2'){ }}
											<p>"{{b.fieldEnName}}" : [{ // {{b.fieldName || '一'}}</p>
											<p>}],</p>
											{{# } else { }}
											<p>"{{b.fieldEnName}}" : "{{b.mockData || '一'}}", // <span style="color: #FFA500; display: inline !important;">{{b.fieldName || '一'}}{{b.fieldEnumListName || ''}}</span></p>
											{{# } }}
										</li>
										{{# } else { }}
										<li class="list-group-item">
											<p>"{{b.fieldEnName}}" : [{ // {{b.fieldName || '一'}}</p>
											<ul class="list-group field">
												{{# layui.each(b.children, function(index, c){ }}
												{{# if(c.children == null || c.children.length == 0){ }}
												<li class="list-group-item">
													{{# if(c.objectType=='2'){ }}
													<p>"{{c.fieldEnName}}" : [{ // {{c.fieldName || '一'}}</p>
													<p>}],</p>
													{{# } else { }}
													<p>"{{c.fieldEnName}}" : "{{c.mockData || '一'}}", // <span style="color: #FFA500; display: inline !important;">{{c.fieldName || '一'}}{{c.fieldEnumListName || ''}}</span></p>
													{{# } }}
												</li>
												{{# } else { }}
												<li class="list-group-item">
													<p>"{{c.fieldEnName}}" : [{ // {{c.fieldName || '一'}}</p>
													<ul class="list-group field">
														{{# layui.each(c.children, function(index, d){ }}
														{{# if(d.children == null || d.children.length == 0){ }}
														<li class="list-group-item">
															{{# if(d.objectType=='2'){ }}
															<p>"{{d.fieldEnName}}" : [{ // {{d.fieldName || '一'}}</p>
															<p>}],</p>
															{{# } else { }}
															<p>"{{d.fieldEnName}}" : "{{d.mockData || '一'}}", // <span style="color: #FFA500; display: inline !important;">{{d.fieldName || '一'}}{{d.fieldEnumListName || ''}}</span></p>
															{{# } }}
														</li>
														{{# } else { }}
														<li class="list-group-item">
															<p>"{{d.fieldEnName}}" : [{ // {{d.fieldName || '一'}}</p>
															<ul class="list-group field">
																{{# layui.each(d.children, function(index, e){ }}
																<li class="list-group-item">
																	<p>"{{e.fieldEnName}}" : "{{e.mockData || '一'}}", // <span style="color: #FFA500; display: inline !important;">{{e.fieldName || '一'}}{{e.fieldEnumListName || ''}}</span></p>
																</li>
																{{# }); }}
															</ul>
															<p>}],</p>
														</li>
														{{# } }}
														{{# }); }}
													</ul>
												</li>
												{{# } }}
												{{# }); }}
											</ul>
											<p>}],</p>
										</li>
										{{# } }}
										{{# }); }}
									</ul>
									<p>}],</p>
								</li>
								{{# }}}
								{{# }); }}
							</ul>
							<p>}</p>
						</li>
					</ul>
					<p>}</p>
				</div>
			</li>
		</ul>
	</div>
</script>

<script id="virtualUsageTpl" type="text/template">
	{{# layui.each(d.list, function(index, a){ }}
	<div class="panel panel-default virtualUsage">
		<div class="panel-heading" data-toggle="collapse"  href="#collapse{{a.sortNum}}" data-id="{{a.id}}">
			<h1 class="panel-title">
				<span class="badge badge-primary">{{index+1}}</span>
				<span>{{a.slaveInterfaceName}}&nbsp;&nbsp;{{a.dubboUrl}}</span>
			</h1>
		</div>
		<div id="collapse{{a.sortNum}}" class="panel-collapse collapse"></div>
	</div>
	{{# }); }}
</script>
<!--关联字段模板-->
<script id="contentFieldTpl" type="text/template">
	<ul class="nav nav-tabs" role="tablist">
		<li class="active"><a href="#params-in" role="tab" data-toggle="tab">入参({{d.inFieldCount}})</a></li>
		<li><a href="#params-out" role="tab" data-toggle="tab">出参({{d.outFieldCount}})</a></li>
	</ul>
	<div class="tab-content">
		<div role="tabpanel" class="tab-pane active" id="params-in">
			<table class="table">
				<thead>
				<tr>
					<th>编号</th>
					<th>中文名称</th>
					<th>字段名称</th>
					<th>类型</th>
					<th>外键类型</th>
					<th>是否枚举字段</th>
					<th>是否状态字段</th>
					<th>数据类型</th>
					<th>字符数</th>
					<th>模拟数据</th>
					<th>模拟数据明细举例</th>
					<th>字段需求故事</th>
				</tr>
				</thead>
				<tbody>
				{{# layui.each(d.inFieldList, function(index, a){ }}
				<tr>
					<td>{{a.id || '一'}}</td>
					<td>{{a.fieldName || '一'}}</td>
					<td>{{a.fieldEnName || '一'}}</td>
					<td>{{# if(a.fieldType=='1') { }} 主键 {{# } else if(a.fieldType == '2') { }} 外键 {{#} else { }}属性{{#}}}</td>
					<td>{{# if(a.fkFieldType=='1'){ }}核心模型关系{{# } else {}}冗余模型关系{{#} }}</td>
					<td>一</td>
					<td>{{# if(a.isFieldStatus=='N'){ }}否{{# } else {}}是{{#} }}</td>
					<td>{{# if(a.fieldDataType=='1') { }} 文本 {{# } else if(a.fieldDataType == '2') { }} 数字 {{#} else { }}时间{{#}}}</td>
					<td>一</td>
					<td>{{a.mockData || '一'}}</td>
					<td>{{a.mockDescription || '一'}}</td>
					<td>{{a.fieldStory || '一'}}</td>
				</tr>
				{{# }); }}
				</tbody>
			</table>
		</div>
		<div role="tabpanel" class="tab-pane" id="params-out">
			<table class="table">
				<thead>
				<tr>
					<th>编号</th>
					<th>中文名称</th>
					<th>字段名称</th>
					<th>类型</th>
					<th>外键类型</th>
					<th>是否枚举字段</th>
					<th>是否状态字段</th>
					<th>数据类型</th>
					<th>字符数</th>
					<th>模拟数据</th>
					<th>模拟数据明细举例</th>
					<th>字段需求故事</th>
				</tr>
				</thead>
				<tbody>
				{{# layui.each(d.outFieldList, function(index, a){ }}
				<tr>
					<td>{{a.id || '一'}}</td>
					<td>{{a.fieldName || '一'}}</td>
					<td>{{a.fieldEnName || '一'}}</td>
					<td>{{# if(a.fieldType=='1') { }} 主键 {{# } else if(a.fieldType == '2') { }} 外键 {{#} else { }}属性{{#}}}</td>
					<td>{{# if(a.fkFieldType=='1'){ }}核心模型关系{{# } else {}}冗余模型关系{{#} }}</td>
					<td>一</td>
					<td>{{# if(a.isFieldStatus=='N'){ }}否{{# } else {}}是{{#} }}</td>
					<td>{{# if(a.fieldDataType=='1') { }} 文本 {{# } else if(a.fieldDataType == '2') { }} 数字 {{#} else { }}时间{{#}}}</td>
					<td>一</td>
					<td>{{a.mockData || '一'}}</td>
					<td>{{a.mockDescription || '一'}}</td>
					<td>{{a.fieldStory || '一'}}</td>
				</tr>
				{{# }); }}
				</tbody>
			</table>
		</div>
	</div>
</script>

<!--关联字段模板-->
<script id="contentTableTpl" type="text/template">
	{{# layui.each(d, function(index, a){ }}
		<div class="retation-table">
			<p class="blue-background">
				<img th:src="@{/img/table.png}">
				<span>{{a.tableName}}&nbsp;&nbsp;{{a.tableEnName}}</span>
				<span  style="color: #0088FF;float: right;margin-right: 12px;"><a class = "table-detail" tableId = "{{a.id}}">查看详情</a></span>
			</p>
			<ul class="list-group">
				{{# layui.each(a.fieldInfoList, function(indexB, b){ }}
					{{# if(b.categorySpace) { }}
						<li class="list-group-item space"></li>
					{{# }}}
					<li class="list-group-item">
						<font>{{# if(b.fieldType=='1') { }} PK {{# } else if(b.fieldType == '2') { }} FK {{#} else { }}-{{#}}}</font>
						<span title="{{b.fieldName || '一'}}">{{b.fieldName || '一'}}</span>
						<span>
							{{b.fieldEnName || '一'}}
							{{# if(b.fieldLength) { }}
								({{b.fieldLength}})
							{{# } }}
						</span>
						<span>{{# if(b.fieldDataType=='1') { }} 文本 {{# } else if(b.fieldDataType == '2') { }} 数字 {{#} else { }}日期{{#}}}</span>
					</li>
				{{# }); }}
			</ul>
		</div>
	{{# }); }}
</script>

<!--关联页面模板-->
<script id="contentPageTpl" type="text/template">
	<div>
		<p>
			<img th:src="@{/img/document.png}" style = "margin-top:-3px;"/>
			<span>接口局部页面({{d.interfaceFileList.length}})</span>
		</p>
		<ul class="list-group">
			{{# layui.each(d.interfaceFileList, function(indexB, b){ }}
			<li class="list-group-item">
				<div><img class = "partPage" src="{{b.filePath}}" th:onerror="this.src='/img/default-img.png'"/></div>
				<p style="text-align: center">{{b.fileName}}</p></li>
			{{# }); }}
		</ul>
	</div>

	<div>
		<p>
			<img th:src="@{/img/document.png}" style = "margin-top:-3px;"/>
			<span>关联结构页面({{d.pageFileList.length}})</span>
		</p>
		<ul class="list-group">
			{{# layui.each(d.pageFileList, function(indexB, b){ }}
			<li class="list-group-item">
				<div><img class = "partPage" src="{{b.filePath}}" th:onerror="this.src='/img/default-img.png'"/></div>
				<p style="text-align: center">{{b.fileName}}</p></li>
			{{# }); }}
		</ul>
	</div>
</script>

<!--关联用况模板-->
<script id="contentUsageTpl" type="text/template">
	<ul class="list-group">
		{{# layui.each(d, function(index, a){ }}
			<li class="list-group-item">
				<div class="list-tit">
					<p>
						<span>{{# if(a.fbType=='1') { }} 前台 {{#} else { }}后台{{#}}}</span>
						<span>{{# if(a.usageType=='1') { }} 增 {{# } else if(a.usageType == '2') { }} 删 {{# } else if(a.usageType == '3') { }} 改 {{#} else { }}查{{#}}}</span>
						<span>{{a.usageyName || '一'}}</span>
						<a class="pull-right" style = "cursor: pointer;" onclick="usageDetail({{a.id}})">查看详情</a>
					</p>
					<p>
						<span>用况架构</span>
						<span>
							{{# if(a.clientType=='1') { }} PCweb {{# } else if(a.clientType == '2') { }} H5 {{# } else if(a.clientType == '3') { }} APP {{#} else { }} 微信小程序 {{#}}}
							· {{# if(a.isAlone=='1') { }} 单模块 {{#} else { }} 非单模块 {{# }}}
							· {{# if(a.versionType=='1') { }} 新功能 {{# } else if(a.versionType == '2') { }} 优化 {{#} else { }} 废弃 {{#}}}
						</span>
					</p>
				</div>
				<div class="list-content">
					<p>用况故事</p>
					<p>{{a.usageStory || '一'}}</p>
				</div>
				<div class="list-content">
					<p>价值描述</p>
					<p>{{a.valueDescription || '一'}}</p>
				</div>
				<div class="list-content">
					<p>业务实现逻辑</p>
					<p>{{a.businessImplDescription || '一'}}</p>
				</div>
				<div class="list-content">
					<p>优化或废弃说明</p>
					<p>{{a.versionDescription || '一'}}</p>
				</div>
			</li>
		{{# }); }}
	</ul>
</script>

<!--关联业务系统模板-->
<script id="contentBusinessSystemTpl" type="text/template">
	{{# layui.each(d, function(index, a){ }}
	<div>
		<img th:src="@{/img/Icon-xitong.png}"/><span>{{a.businessSystemName}}</span>
		<a class="pull-right" style = "cursor: pointer;" onclick="businessSystemDetail({{a.id}})">查看详情</a>
	</div>
	<div style="margin-top: 15px;color: rgba(0,0,0,0.85);">{{a.businessSystemDescription||''}}</div>
	{{# }); }}
</script>

<!--问题备注模板-->
<script id="contentQuestionTpl" type="text/template">
	{{# if(d.questionCount== 0){ }}
		<div class="empty">
			<p><img th:src="@{/img/empty.png}"/></p>
			<p>暂无问题备注</p>
			<p><button type="button" class="btn btn-primary add-question">提交问题</button></p>
		</div>
	{{# } else {}}
		<div class="questions">
			<p class="pull-left">当前共{{d.questionCount}}个问题</p>
			{{# if(d.owner) { }}
			<a class="pull-right add-question" style = "cursor: pointer;"><img th:src="@{/img/Icon-add.png}" class="icon" style="padding-right: 4px;margin-top: -3px;" />提问题</a>
			{{# } }}
		</div>
		<ul class="list-group ques-list">
			{{# layui.each(d.list, function(index, a){ }}
				<li class="list-group-item">
					<div>
						<div class="pull-left">
							<span><img class="head-img list-head-img" th:src="@{/img/login-background.jpg}"/>· {{a.createBy || '一'}} · {{a.createTime || '一'}}<span>
						</div>
						{{# if(d.owner) { }}
						<div class="pull-right">
							<icon class="icon del delete-question" data-id="{{a.id}}" style = "cursor: pointer;"></icon>
						</div>
						{{# } }}
					</div>
					<p>{{a.title || '一'}}</p>
					<p>{{a.description || '一'}}</p>
					<ul class="list-group-horizontal">
						{{# layui.each(a.fileInfList, function(indexB, b){ }}
						<li class="list-group-item" style="box-shadow:none"><img class = "partPage" src="{{b.filePath}}" th:onerror="this.src='/img/default-img.png'"/><p style="text-align: center">{{b.fileName}}</p></li>
						{{# }); }}
					</ul>
				</li>
			{{# }); }}
		</ul>

	{{#} }}
</script>

<script th:inline="javascript">
    // 接口uri
    const prefix = ctx + "interface/interface";
	var owner = [[${owner}]];
    $(function () {
		// 接口详情默认加载
		doPreview();

		$("#status").change(function () {
			var value = $(this).val();
			var config = {
				url: ctx + "userDataAuth/userDataAuth/updateStatus",
				type: "POST",
				dataType: "json",
				data: "objectId=" + $("#id").val() + "&objectType=5&objectStatus=" + value,
				beforeSend: function () {
					$.modal.loading("正在处理中，请稍后...");
				},
				success: function(result) {
					$.modal.closeLoading();
					if (result.code == web_status.SUCCESS) {
						$.modal.msgSuccess("更新成功");
					} else if (result.code == web_status.WARNING) {
						$.modal.alertWarning(result.msg)
					} else {
						$.modal.alertError(result.msg);
					}
				}
			};
			$.ajax(config);
		})
	});

    $("body").on('click','.del',function(){
        $(this).parents(".list-group-item").remove();
    }).on('click', ".partPage", function(e) {
    	var url = $(this).attr("src");
        var json = {
            "title": "预览",
            "start": 0,
            "data": [{
                "src": url,
            }]
        };
        layer.photos({
            photos: json,
            closeBtn: 0, //右上角按钮，可通过配置1和2来展示，如果不显示，则closeBtn: 0
            anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
        });
	}).on('click', ".add-question", function () {
		var title = "提问题";
		var interfaceId = $("input[name='id']").val();
		var url = prefix + "/add_question/" + interfaceId + "/1";
		var width = 800;
		var height = $(window).height() - 50;
		$.modal.open(title, url, width, height);
	}).on('click', ".table-detail", function () {
	    var tableId = $(this).attr("tableId");
		$.operate.addTab2("表详情", prefix + "/table_detail/" + tableId);
    }).on('click','.virtualUsage .panel-heading',function(){
        var idName = $(this).attr("href");
        $(idName).html().length ==0 && paramList(idName, $(this).data("id"), 3);
    }).on('click','.delete-question',function(){
        var id = $(this).attr("data-id");
		var config = {
			url: ctx + "questionInfo/questionInfo/remove?ids=" + id,
			type: "POST",
			dataType: "json",
			data: null,
			beforeSend: function () {
				$.modal.loading("正在处理中，请稍后...");
			},
			success: function(result) {
				$.modal.closeLoading();
				if (result.code == web_status.SUCCESS) {
					$.modal.msgSuccess("删除成功");
					relationQuestionList();
				} else if (result.code == web_status.WARNING) {
					$.modal.alertWarning(result.msg)
				} else {
					$.modal.alertError(result.msg);
				}
			}
		};
		$.ajax(config);
    });

    /**标签切换事件*/
    $(".contentTab a").click(function (e) {
        var action = $(this).data("action");
        if(action) {
			window[action]();
		}
    });

	/**
	 * 预览
	 */
	function doPreview() {
        paramList();
        virtualUsageList();
    }
	function paramList(idName,interfaceId,interfaceType) {
        idName = idName||'#collapse0';
		var params = {};
		params.interfaceId = interfaceId || $("input[name='id']").val();
		if (interfaceType) {
			params.interfaceType = interfaceType
		} else {
			var fbType = $("input[name='fbType']").val();
			if (fbType == 3 || fbType == '3') {
				params.interfaceType = 4;
			} else {
				params.interfaceType = fbType;
			}
		}

		var resultJson;
		var config = {
			url: prefix + "/paramList",
			type: "POST",
			dataType: "json",
			data: params,
			success: function (result) {
				if (result && result.code == 0) {
                    var contentPreviewTplHtml = $("#contentPreviewTpl").html();
                    var data = result.data;
					convertResponse(data);
                    laytpl(contentPreviewTplHtml).render(data, function (html) {
                        $(idName).empty();
                        $(idName).append(html);
                    });
				}
			}
		};
		$.ajax(config);
	}

	function virtualUsageList(){
        var virtualUsageListConfig = {
            url: prefix + "/virtualUsageList?interfaceId="+$("input[name='id']").val(),
            type: "post",
            dataType: "json",
            data: null,
            beforeSend: function () {
                $.modal.loading("正在处理中，请稍后...");
            },
            success: function(result) {
                $.modal.closeLoading();
                if (result.code == web_status.SUCCESS) {
                    var data = {};
                    data.list = result.data || [];
                    var paramsTplHtml = $("#virtualUsageTpl").html();
                    laytpl(paramsTplHtml).render(data, function (html) {
                        $(".virtualUsage").remove();
                        $("#virtualUsage").after(html);
                    });
                } else if (result.code == web_status.WARNING) {
                    $.modal.alertWarning(result.msg)
                } else {
                    $.modal.alertError(result.msg);
                }
            }
        };
        $.ajax(virtualUsageListConfig);
	}

    /**
     * 关联字段列表函数
     */
    function relationFieldList() {
        var params = {};
        params.interfaceId = $("input[name='id']").val();
		var fbType = $("input[name='fbType']").val();
		if (fbType == 3 || fbType == '3') {
			params.interfaceType = 4;
		} else {
			params.interfaceType = fbType;
		}
        var resultJson;
        var config = {
            url: prefix + "/fieldList",
            type: "POST",
            dataType: "json",
            async: false,
            data: params,
            success: function (result) {
                if (result && result.code == 0) {
                    resultJson = result.data;
                }
            }
        };
        $.ajax(config);
        if(!resultJson) {
            return false;
        }
        resultJson.inFieldCount = resultJson.inFieldList == null ? 0 : resultJson.inFieldList.length;
        resultJson.outFieldCount = resultJson.outFieldList == null ? 0 : resultJson.outFieldList.length;
        var contentFieldTplHtml = $("#contentFieldTpl").html();
        laytpl(contentFieldTplHtml).render(resultJson, function (html) {
            $("#content-field").empty();
            $("#content-field").append(html);
        });
    };

    /**
     * 关联表列表函数
     */
    function relationTableList() {
        var params = {};
        params.interfaceId = $("input[name='id']").val();
		var fbType = $("input[name='fbType']").val();
		if (fbType == 3 || fbType == '3') {
			params.interfaceType = 4;
		} else {
			params.interfaceType = fbType;
		}
        var resultJson;
        var config = {
            url: prefix + "/interfaceTableList",
            type: "POST",
            dataType: "json",
            async: false,
            data: params,
            success: function (result) {
                if (result && result.code == 0) {
                    resultJson = result.data;
                }
            }
        };
        $.ajax(config);
        if(!resultJson) {
            return false;
        }
        $.each(resultJson, function (index, a) {
            if (null == a.fieldInfoList || 0 == a.fieldInfoList.length) {
                return;
            }
            let category = a.fieldInfoList[0].category;
            $.each(a.fieldInfoList, function (indexB, b) {
                b.categorySpace = false;
                if (category != b.category) {
                    b.categorySpace = true;
                    category = b.category;
                }
            });
        });
        var contentTableTplHtml = $("#contentTableTpl").html();
        laytpl(contentTableTplHtml).render(resultJson, function (html) {
            $("#content-table").empty();
            $("#content-table").append(html);
        });
    };

    /**
     * 关联页面函数
     */
    function relationPageList() {
        var params = {};
        params.interfaceId = $("input[name='id']").val();
        var resultJson;
        var config = {
            url: prefix + "/pageList",
            type: "POST",
            dataType: "json",
            async: false,
            data: params,
            success: function (result) {
                if (result && result.code == 0) {
                    resultJson = result.data;
                }
            }
        };
        $.ajax(config);

        var contentPageTplHtml = $("#contentPageTpl").html();
        laytpl(contentPageTplHtml).render(resultJson, function (html) {
            $("#content-page").empty();
            $("#content-page").append(html);
        });
    };

    /**
     * 关联用况函数
     */
    function relationUsageList() {
        var params = {};
        params.interfaceId = $("input[name='id']").val();
        var resultJson;
        var config = {
            url: prefix + "/usageList",
            type: "POST",
            dataType: "json",
            async: false,
            data: params,
            success: function (result) {
                if (result && result.code == 0) {
                    resultJson = result.data;
                }
            }
        };
        $.ajax(config);
        if(!resultJson) {
            return false;
        }
        var contentUsageTplHtml = $("#contentUsageTpl").html();
        laytpl(contentUsageTplHtml).render(resultJson, function (html) {
            $("#content-usage").empty();
            $("#content-usage").append(html);
        });
    };

    /**
     * 关联业务系统函数
     */
    function relationBusinessSystemList() {
        var params = {};
        params.interfaceId = $("input[name='id']").val();
		var fbType = $("input[name='fbType']").val();
		if (fbType == 3 || fbType == '3') {
			params.interfaceType = 4;
		} else {
			params.interfaceType = fbType;
		}
        var resultJson;
        var config = {
            url: prefix + "/businessSystemList",
            type: "POST",
            dataType: "json",
            async: false,
            data: params,
            success: function (result) {
                if (result && result.code == 0) {
                    resultJson = result.data;
                }
            }
        };
        $.ajax(config);
        if(!resultJson) {
            return false;
        }
        var contentBusinessSystemTplHtml = $("#contentBusinessSystemTpl").html();
        laytpl(contentBusinessSystemTplHtml).render(resultJson, function (html) {
            $("#content-service").empty();
            $("#content-service").append(html);
        });
    };

    /**
     * 问题备注
     */
    function relationQuestionList() {
        var params = {};
        params.objectId = $("input[name='id']").val();
        params.objectType = "1";
        var resultJson;
        var config = {
            url: prefix + "/questionList",
            type: "POST",
            dataType: "json",
            async: false,
            data: params,
            success: function (result) {
                if (result && result.code == 0) {
                    resultJson = result.data;
                }
            }
        };
        $.ajax(config);
        if(!resultJson) {
            return false;
        }
        var data = {};
        data.list = resultJson;
        data.questionCount = resultJson.length;
        data.owner = owner;
        var contentQuestionTplHtml = $("#contentQuestionTpl").html();
        laytpl(contentQuestionTplHtml).render(data, function (html) {
            $("#content-question").empty();
            $("#content-question").append(html);
        });
    };

	function businessSystemDetail(id) {
		$.operate.addTab2("业务系统详情", ctx + "businessSystem/businessSystem/detail/" + id);
	}

	function usageDetail(id) {
		$.operate.addTab2("用况详情", ctx + "usage/usage/detail/" + id);
	}
</script>
</html>
